package com.ruoyi.waterManagement.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.core.domain.business.waterManagement.StationPicR;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.waterManagement.mapper.StationPicRMapper;
import com.ruoyi.waterManagement.service.IStationPicRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 测站实时图片Service业务层处理
 * 
 * @author hwd
 * @date 2023-03-02
 */
@Service
public class StationPicRServiceImpl implements IStationPicRService
{
    @Autowired
    private StationPicRMapper stationPicRMapper;

    /**
     * 查询测站实时图片
     * 
     * @param statCd 测站实时图片主键
     * @return 测站实时图片
     */
    @Override
    public StationPicR selectStationPicRByStatCd(String statCd)
    {
        return stationPicRMapper.selectStationPicRByStatCd(statCd);
    }

    /**
     * 查询测站实时图片列表
     * 
     * @param stationPicR 测站实时图片
     * @return 测站实时图片
     */
    @Override
    public List<StationPicR> selectStationPicRList(StationPicR stationPicR)
    {
        return stationPicRMapper.selectStationPicRList(stationPicR);
    }

    /**
     * 新增测站实时图片
     * 
     * @param stationPicR 测站实时图片
     * @return 结果
     */
    @Override
    public int insertStationPicR(StationPicR stationPicR)
    {
        stationPicR.setCreateTime(DateUtils.getNowDate());
        return stationPicRMapper.insertStationPicR(stationPicR);
    }

    /**
     * 修改测站实时图片
     * 
     * @param stationPicR 测站实时图片
     * @return 结果
     */
    @Override
    public int updateStationPicR(StationPicR stationPicR)
    {
        stationPicR.setUpdateTime(DateUtils.getNowDate());
        return stationPicRMapper.updateStationPicR(stationPicR);
    }

    /**
     * 批量删除测站实时图片
     * 
     * @param statCds 需要删除的测站实时图片主键
     * @return 结果
     */
    @Override
    public int deleteStationPicRByStatCds(String[] statCds)
    {
        return stationPicRMapper.deleteStationPicRByStatCds(statCds);
    }

    /**
     * 删除测站实时图片信息
     * 
     * @param statCd 测站实时图片主键
     * @return 结果
     */
    @Override
    public int deleteStationPicRByStatCd(String statCd)
    {
        return stationPicRMapper.deleteStationPicRByStatCd(statCd);
    }

    @Override
    public List<StationPicR> cameraStationPicRList(StationPicR stationPicR) {

        return stationPicRMapper.cameraStationPicRList(stationPicR);
    }

    @Override
    public List<StationPicR> cameraStationPicRByStatCdAndDate(String statCd, Date date) {
        if (date==null){
            date=new Date();
        }
        String [] strings= DateUtils.jsYmd(date);
        String yy =strings[0];
        String mm =strings[1];
        String dd =strings[2];
        return stationPicRMapper.cameraStationPicRByStatCdAndDate(statCd,yy,mm,dd);
    }
}
